local ClientOHOH = _G.ClientOHOH;

local M = ClientOHOH.class.new(script, ClientOHOH.files.OHOHOLYBUIBase());

function InitInsts(ui)
	ui.insts = {
        size={
            [1]={
                icon="ctrl.smallIcon",
                text="ctrl.smallText",
            },
            [2]={
                icon="ctrl.mediumIcon",
                text="ctrl.mediumText",
            },
            [3]={
                icon="ctrl.bigIcon",
                text="ctrl.bigText",
            },
        },
        name="ctrl.name",--名字
        title="ctrl.title",--称号
        evolution="ctrl.evolution",--段位
        boost="ctrl.boost",--加成
        YesSizeColor="ctrl.YesSizeColor",
        NoSizeColor="ctrl.NoSizeColor",
        root="ctrl.root",
    };
end;

function M.new(...)
	return M(...);
end;

function M.ctor(self)
    InitInsts(self)
    M.super.ctor(self, ClientOHOH:GetPath_Loop("ReplicatedStorage.Resource.UI.PetDialog"));
    -- self.main_inst.Parent=
    -- self.main_inst.Visible=false
end;

function M.dtor(self)
	M.super.dtor(self);
end;
local localPlayer=game:GetService("Players").LocalPlayer
local gMouse =localPlayer:GetMouse()

function M.OnShow(self,cell) --显示Cell信息

    if   self.Conn then
        self.Conn:Disconnect()
        self.Conn=nil
    end

    self.insts.evolution.Text=cell:GetEvolutionName()
    self.insts.title.Text=cell:GetTitleName()
    self.insts.evolution.TextColor3=cell:GetEvolutionColor3()
    self.insts.title.TextColor3=cell:GetTitleColor3()
    self.insts.boost.Text=cell:GetBoostStr()
    self.insts.name.Text=cell:GetPetName()
    local sizeId=cell:GetSizeId()

    for k,v  in pairs(self.insts.size) do
        v.icon.ImageColor3=self.insts.NoSizeColor
    end

    self.insts.size[sizeId].icon.ImageColor3=self.insts.YesSizeColor
    self.insts.root.Position=UDim2.fromOffset(gMouse.X,gMouse.Y)
   self.Conn= gMouse.Move:Connect(function()
        self.insts.root.Position=UDim2.fromOffset(gMouse.X,gMouse.Y)
    end)
end

function M.OnHide(self)
    if   self.Conn then
        self.Conn:Disconnect()
        self.Conn=nil
    end
end



return M